#coding=utf-8
import configparser
import os

'''
    读取配置文件中的值
'''
class getini:

    def __init__(self):

        self.element_dict = {}

        config_file = os.path.join(os.path.dirname(__file__), '../Elements.ini')

        config = configparser.ConfigParser()

        config.read(config_file)

        sections = config.sections()

        element_key_dict = {}

        for section in sections:

            element_key_dict.clear()

            for key in config.options(section):

                element_key_dict[key] = config[section][key]

            self.element_dict[section] = element_key_dict.copy()

        # print(element_dict)
        # return element_dict


    def get_ele(self,title,key):

        return self.element_dict[title][key]



if __name__ == "__main__":

    readini()